package com.etone.smartAudit.mapstruct;

import com.etone.smartAudit.domain.AuditRisk;
import com.etone.smartAudit.domain.AuditRiskHistory;
import com.etone.smartAudit.dto.auditRisk.AuditRiskDTO;
import com.etone.smartAudit.vo.auditRisk.AuditRiskDetailVO;
import org.mapstruct.*;

@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface AuditRiskMapstruct {

    @Mappings({
            @Mapping(target = "modules", expression = "java(auditRiskDTO.getModuleFiles() == null ? null : com.alibaba.fastjson.JSON.toJSONString(auditRiskDTO.getModuleFiles()))"),
            @Mapping(target = "processAssets", expression = "java(auditRiskDTO.getProcessAssetFiles() == null ? null : com.alibaba.fastjson.JSON.toJSONString(auditRiskDTO.getProcessAssetFiles()))")
    })
    void copyToAuditRisk(@MappingTarget AuditRisk auditRisk, AuditRiskDTO auditRiskDTO);

    AuditRiskDetailVO getAuditRiskDetailVO(AuditRisk auditRisk);

    AuditRiskHistory getAuditRiskHistory(AuditRisk auditRisk);

}
